using System;
using System.Collections.Generic;
using Microsoft.SqlServer.Management.Smo;

namespace T4MVCGen.Core
{
	/// <summary>
	/// Class that stores information for tables in a database.
	/// </summary>
    /// 
    [Serializable]
	public class T4GenTable
    {
		/// <summary>
		/// Default constructor; initializes all collections.
		/// </summary>
		public T4GenTable()
        {
			this.Columns = new List<T4GenColumn>();
			this.PrimaryKeys = new List<T4GenColumn>();
			this.ForeignKeys = new Dictionary<string, List<T4GenColumn>>();
		}
		
		/// <summary>
		/// Contains the list of Column instances that define the table.
		/// </summary>
		public List<T4GenColumn> Columns { get; private set; }

		/// <summary>
		/// Contains the list of Column instances that define the table.  The Dictionary returned 
		/// is keyed on the foreign key name, and the value associated with the key is an 
		/// List of Column instances that compose the foreign key.
		/// </summary>
		public Dictionary<string, List<T4GenColumn>> ForeignKeys { get; private set; }

		/// <summary>
		/// Name of the table.
		/// </summary>
		public string Name { get; set; }

		/// <summary>
		/// Contains the list of primary key Column instances that define the table.
		/// </summary>
		public List<T4GenColumn> PrimaryKeys { get; private set; }

        public Table Table { get; set; }

	}
}
